package utils;

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class JDBCUtils {
    private static DataSource dataSource = new MysqlDataSource();
    public static Connection getConnection() throws SQLException {
        ((MysqlDataSource)dataSource).setUrl("jdbc:mysql://127.0.0.1:3306/personManage?characterEncoding=utf8&useSSL=false");
        ((MysqlDataSource)dataSource).setUser("root");
        ((MysqlDataSource)dataSource).setPassword("1234");
        Connection connection = dataSource.getConnection();
        return connection;
    }
}
